package cn.edu.mju.dilidili.modules.user.controller;


import cn.edu.mju.dilidili.common.utils.Result;
import cn.edu.mju.dilidili.modules.user.dto.UserLoginRequestDto;
import cn.edu.mju.dilidili.modules.user.dto.UserResponseDto;
import cn.edu.mju.dilidili.modules.user.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户信息表 前端控制器
 * </p>
 *
 * @author l
 * @since 2022-09-24
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/action")
public class UserController {
    final UserService userService;
    @PostMapping("/login")
    Result<UserResponseDto> login(@RequestBody UserLoginRequestDto user) {
        return userService.login(user.getUsername(), user.getPassword());
    }
}
